import request2 from '@/utils/request2'

export interface CartListModel {
  id?: number,
  [propsName: string]: any
}
export default {
  // 获取购物车列表
  getCartList() {
    return request2.get<any, CartListModel>(`/cart/cartList`)
  },
  // 切换商品选中状态
  changeChecked(skuID: string, isChecked: string) {
    return request2.get<any, null>(`/cart/checkCart/${skuID}/${isChecked}`)
  },
  // 加入购物车,修改商品数量
  addToCart(skuId: string, skuNum: string) {
    return request2.post(`/cart/addToCart/${skuId}/${skuNum}`)
  },
  // 购物车商品全选
  changeAllChecked(isChecked: string, skuIdList: string[]) {
    return request2.post<any, null>(`/cart/batchCheckCart/${isChecked}`,skuIdList)
  },
  // 商品详情
  ShopDetail(skuId: string) {
    return request2.get<any, CartListModel>(`/item/${skuId}`)
  },
  // 批量删除
  deletShopCart(skuIdList: CartListModel[]) {
    return request2.post(`/cart/batchDeleteCart`, skuIdList)
  }
}